home *** CD-ROM | disk | FTP | other *** search
/ Amiga Magazin: Amiga-CD 1996 March / Amiga-CD 1996 #3.iso / pd-software / mui_3.1 / developer / oberon / txt / muisemaphore.mod < prev    next >
Text File  |  1996-01-19  |  3KB  |  93 lines

  1. MODULE MUISemaphore;
  2.  
  3. (* $StackChk- $NilChk- $RangeChk- $CaseChk- $OvflChk- $ReturnChk- $ClearVars- *)
  4.  
  5. (* This module is generated by "GenMuiO" © 1995 by Albert Weinert *)
  6.  
  7. IMPORT
  8.   clf := Classface,
  9.   e := Exec,
  10.   m := Mui,
  11.   RootClass,
  12.   I := Intuition,
  13.   y := SYSTEM;
  14.  
  15. CONST
  16.   name *= m.cSemaphore;
  17.  
  18. TYPE
  19.   Class     *= UNTRACED POINTER TO ClassDesc;
  20.   ClassDesc *= RECORD( RootClass.RootClass ) END;
  21.  
  22. VAR
  23.   class * : I.IClassPtr;
  24.  
  25.   PROCEDURE ( VAR c:ClassDesc ) CopyClass*( obj : m.Object );
  26.     BEGIN
  27.       IF obj # NIL THEN
  28.         e.CopyMemAPTR(y.ADR(c),clf.InstData(c.class,obj),c.class.instSize); (* copy into boopsi obj *)
  29.       END;
  30.     END CopyClass;
  31.  
  32.   PROCEDURE ( VAR c:ClassDesc ) Cleanup;
  33.     VAR msg : I.Msg;
  34.     BEGIN
  35.       msg.methodID := m.mCleanup;
  36.       IF clf.CoerceMethodA( c.class, c.object, msg ) = NIL THEN END;
  37.     END Cleanup;
  38.  
  39.    PROCEDURE ( VAR c : ClassDesc ) mSemaphoreAttempt*( VAR msg : m.pSemaphoreAttempt ):e.APTR;
  40.      BEGIN
  41.        msg.msg.methodID := m.mSemaphoreAttempt;
  42.        RETURN clf.DoSuperMethodA( c.class, c.object, msg )
  43.      END mSemaphoreAttempt;
  44.  
  45.    PROCEDURE ( VAR c : ClassDesc ) mSemaphoreAttemptShared*( VAR msg : m.pSemaphoreAttemptShared ):e.APTR;
  46.      BEGIN
  47.        msg.msg.methodID := m.mSemaphoreAttemptShared;
  48.        RETURN clf.DoSuperMethodA( c.class, c.object, msg )
  49.      END mSemaphoreAttemptShared;
  50.  
  51.    PROCEDURE ( VAR c : ClassDesc ) mSemaphoreObtain*( VAR msg : m.pSemaphoreObtain ):e.APTR;
  52.      BEGIN
  53.        msg.msg.methodID := m.mSemaphoreObtain;
  54.        RETURN clf.DoSuperMethodA( c.class, c.object, msg )
  55.      END mSemaphoreObtain;
  56.  
  57.    PROCEDURE ( VAR c : ClassDesc ) mSemaphoreObtainShared*( VAR msg : m.pSemaphoreObtainShared ):e.APTR;
  58.      BEGIN
  59.        msg.msg.methodID := m.mSemaphoreObtainShared;
  60.        RETURN clf.DoSuperMethodA( c.class, c.object, msg )
  61.      END mSemaphoreObtainShared;
  62.  
  63.    PROCEDURE ( VAR c : ClassDesc ) mSemaphoreRelease*( VAR msg : m.pSemaphoreRelease ):e.APTR;
  64.      BEGIN
  65.        msg.msg.methodID := m.mSemaphoreRelease;
  66.        RETURN clf.DoSuperMethodA( c.class, c.object, msg )
  67.      END mSemaphoreRelease;
  68.  
  69.   PROCEDURE Dispatch * ( cl : I.IClassPtr; obj : I.ObjectPtr; msg : I.MsgPtr ):e.APTR;
  70.     VAR c : Class;
  71.     BEGIN
  72.       IF msg.methodID # I.new THEN
  73.         c := RootClass.BoopsiToObj( cl, obj )(Class);
  74.       END;
  75.  
  76.       CASE msg.methodID OF
  77.         | m.mSemaphoreAttempt         : RETURN c.mSemaphoreAttempt( msg^(m.pSemaphoreAttempt) );
  78.         | m.mSemaphoreAttemptShared   : RETURN c.mSemaphoreAttemptShared( msg^(m.pSemaphoreAttemptShared) );
  79.         | m.mSemaphoreObtain          : RETURN c.mSemaphoreObtain( msg^(m.pSemaphoreObtain) );
  80.         | m.mSemaphoreObtainShared    : RETURN c.mSemaphoreObtainShared( msg^(m.pSemaphoreObtainShared) );
  81.         | m.mSemaphoreRelease         : RETURN c.mSemaphoreRelease( msg^(m.pSemaphoreRelease) );
  82.       ELSE
  83.         RETURN RootClass.Dispatch( cl, obj, msg );
  84.       END;
  85.     END Dispatch;
  86.  
  87. BEGIN
  88.   class := m.GetClass( name );
  89.   IF class = NIL THEN HALT( 205 ) END; (* Error : Object not Found *)
  90. CLOSE
  91.   IF class # NIL THEN m.FreeClass( class ) END;
  92. END MUISemaphore.
  93.